package com.example.jdt_xiazai.base;

import java.util.ArrayList;

public abstract class BasePresenter<V extends BaseView> {
    protected V view;
    private ArrayList<BaseModel> models=new ArrayList<>();

    public BasePresenter() {
        initModel();
    }
    public void addModel(BaseModel baseModel){
        models.add(baseModel);

    }
    protected abstract void initModel();


    public void bindView(V mView) {
        view=mView;
    }

    public  void onDestroy(){
        if (models!=null&&models.size()>0){
            for (int i = 0; i <models.size() ; i++) {
                models.get(i).onDestroy();

            }
        }
    }

}
